[GH-ISSUE #556] Need method to generate random code verifier and code challenge #369

Closed
opened 2026-03-03 16:48:07 +03:00 by kerem · 3 comments
Owner

Originally created by @dingtianran on GitHub (Nov 6, 2019).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/556

Need some helper methods to generate random code verifier and code challenge. In order to adapt pace protocol, currently I'm using two class methods from https://github.com/openid/AppAuth-iOS to generate them. I think it'll be very handy to have them in OAuthSwift as well.

like:
+ (nullable NSString *)generateCodeVerifier;
+ (nullable NSString *)codeChallengeS256ForVerifier:(nullable NSString *)codeVerifier;

Originally created by @dingtianran on GitHub (Nov 6, 2019). Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/556 Need some helper methods to generate random code verifier and code challenge. In order to adapt pace protocol, currently I'm using two class methods from https://github.com/openid/AppAuth-iOS to generate them. I think it'll be very handy to have them in `OAuthSwift` as well. like: `+ (nullable NSString *)generateCodeVerifier;` `+ (nullable NSString *)codeChallengeS256ForVerifier:(nullable NSString *)codeVerifier;`
kerem 2026-03-03 16:48:07 +03:00
Author
Owner

@phimage commented on GitHub (Nov 6, 2019):

@dingtianran
you use it to connect to?
there is an openID layer upon oauth2?

<!-- gh-comment-id:550219705 --> @phimage commented on GitHub (Nov 6, 2019): @dingtianran you use it to connect to? there is an openID layer upon oauth2?
Author
Owner

@phimage commented on GitHub (Nov 16, 2019):

I see that seconde function depend on sha256 https://github.com/OAuthSwift/OAuthSwift/issues/540

https://tools.ietf.org/html/rfc7636#section-4.2
code_challenge = BASE64URL-ENCODE(SHA256(ASCII(code_verifier)))

<!-- gh-comment-id:554647513 --> @phimage commented on GitHub (Nov 16, 2019): I see that seconde function depend on sha256 https://github.com/OAuthSwift/OAuthSwift/issues/540 https://tools.ietf.org/html/rfc7636#section-4.2 code_challenge = BASE64URL-ENCODE(SHA256(ASCII(code_verifier)))
Author
Owner

@MrWoWander commented on GitHub (Mar 2, 2021):

I wrote and sent to the PR #647 generator random code verifier and code challenge

<!-- gh-comment-id:788653919 --> @MrWoWander commented on GitHub (Mar 2, 2021): I wrote and sent to the PR #647 generator random code verifier and code challenge
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/OAuthSwift#369
No description provided.