Commit c871265
Add support for custom state and nonce parameters in OAuth2 authorization
- Add optional state parameter support to OAuth2Provider constructor
- Add optional nonce parameter support to OAuth2Provider constructor
- Use custom state parameter if provided, otherwise generate UUID (maintains backward compatibility)
- Include nonce parameter in authorization URL when provided
- Both parameters are properly URL-encoded for security
This enables developers to:
- Pass custom state values for enhanced CSRF protection
- Include nonce parameter for OpenID Connect ID token verification
- Maintain existing behavior when parameters are not provided
Note: The existing commented-out state verification code should be
uncommented and updated to properly validate returned state parameters.1 parent a0a7613 commit c871265
1 file changed
+18
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
| 73 | + | |
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
93 | 102 | | |
94 | 103 | | |
95 | 104 | | |
| |||
99 | 108 | | |
100 | 109 | | |
101 | 110 | | |
102 | | - | |
| 111 | + | |
103 | 112 | | |
104 | | - | |
| 113 | + | |
| 114 | + | |
105 | 115 | | |
106 | 116 | | |
107 | 117 | | |
| |||
134 | 144 | | |
135 | 145 | | |
136 | 146 | | |
137 | | - | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
138 | 150 | | |
139 | 151 | | |
140 | 152 | | |
| |||
0 commit comments