Closed thezachdrake closed 1 month ago
There are not enough details to understand what is the issue in your case and what platform you are targetting but I don't think it is PocketBase related because I'm not able to reproduce it.
The state parameter is added automatically as query parameter to the launched url.
I've just tested it with the below minimal Dart code sample and it works correctly for me when running dart main.dart
.
// main.dart
import "dart:io";
import "package:pocketbase/pocketbase.dart";
void main() {
final pb = PocketBase("http://127.0.0.1:8090");
pb.collection("users").authWithOAuth2("gitlab", (url) async {
// I'm using the linux command to open the url from the terminal
// but you can use any other launch method
await Process.run("xdg-open", [url.toString()]);
}).then((result) {
// success...
print("Result: $result");
}).catchError((dynamic error) {
// error...
print("Error: $error");
});
}
If you are testing with Flutter Web make sure to check the Limitations section.
If you still think that it is a PocketBase issue, feel free to provide a more complete code sample or minimal repo illustrating the problem and I'll try to investigate it further.
When I try to run Google OAuth2 it never creates the user.
In flutter I am running:
pb.collection('users').authWithOAuth2("google", _oauthUrlLanucher);
It takes me to Google fine , the auth is successful on Google's end, and it redirects to the pocketbase server.
Then in the terminal of the running pocketbase instance I get this:
I don't see anywhere to add state in the OAuth initiation flow. Is there a param I need to set to get this to work?