yourkarma / JWT

A JSON Web Token implementation in Objective-C.
MIT License
351 stars 107 forks source link

Not able to encode JWT data in Objective-C #117

Open kashiftriffort opened 7 years ago

kashiftriffort commented 7 years ago

Hi,

I am using this method for encoding of JWT

    NSDictionary *payload = @{@"sub": @"1234567890", @"name": @"Kashif", @"admin" : @"iOS"};
    NSString *secret = @"secret";
    id<JWTAlgorithm> algorithm = [JWTAlgorithmFactory algorithmByName:@"HS256"];
    NSString *result = [JWTBuilder encodePayload:payload].secret(secret).algorithm(algorithm).encode;
    NSLog(@"%@",result);

However its showing that secret and algorithm is deprecated. In tutorial, same thing is given to use. Please help me out in this.

New Issue Checklist

Issue Info

Info Value
Platform Name e.g. ios / osx / tvos / watchos
Platform Version e.g. 8.0
CocoaLumberjack Version e.g. 2.3.0
Integration Method e.g. carthage / cocoapods / manually
Xcode Version e.g. Xcode 7.3
Repro rate e.g. all the time (100%) / sometimes x% / only once
Demo project link e.g. link to a demo project that highlights the issue

Issue Description and Steps

Please fill in the detailed description of the issue (full output of any stack trace, compiler error, ...) and the steps to reproduce the issue.

lolgear commented 7 years ago

Hi! Which dependency manager do you use? You could try version 3.0.0-beta.1 in case of Cocoapods ;)

kashiftriffort commented 7 years ago

Okay, In future if pod file updated then deprecated functions will be removed.

lolgear commented 7 years ago

@kashiftriffort maybe in distant future. In current paradigm old API saved in version categories.

lolgear commented 7 years ago

@kashiftriffort could be closed? I plan update rsa tests before version release. Maybe add some shortcuts in new API.

cargath commented 4 years ago

I'm having the same issue - in the latest stable release JWTBuilder.secret() is deprecated, but JWTAlgorithmDataHolderProtocol doesn't exist yet. I don't want to use neither a deprecated method (that produces warnings) nor a pre-release version of a Framework in a production app 🤷‍♂️