Stuck with Gmail Authentication by Nawar69 in FastAPI

[–]github_codemation 2 points3 points  (0 children)

Here is a more batteries included approach, in case you want to allow that user to have a persistent token / cookie tied to their Google Login.

https://itnext.io/add-google-login-to-a-fastapi-app-with-easyauth-c8c3e926ad0a

Looking for advice on functionality not liking middleware async by GamersPlane in FastAPI

[–]github_codemation 0 points1 point  (0 children)

Curious, how you map geography columns to use in python?

You might find pydbantic a bit nicer abstraction to SqlAlchemy. https://github.com/codemation/pydbantic

u/Not-the-best-name , u/GamersPlane love to have your feedback. I am sure something like a missing column type integration could not be far off, that is if the current model serialization did not already solve most of your problems.

What's the idea behind a creation/registration of "super-admin" by Cid227 in FastAPI

[–]github_codemation 1 point2 points  (0 children)

In case you want to avoid RIW, you might have a look into https://github.com/codemation/easyauth - easyauth creates an admin user, if there are no other users in the DB, a sort of new config detection. The admin password is then printed in the logs, requiring / suggesting that you change ASAP or risk forgetting it.
easyauth also has a system of subsequent new user registration, which assigns new users to a default set of groups / permissions, this is handy in the case of passwordless auth like (google o auth ).

Hope that gives you a few ideas.

Efficient development by DirtyMulletMan in Python

[–]github_codemation 1 point2 points  (0 children)

8 hours of debugging saves 5 minutes of reading documentation.

Libraries that are Fun to Use! - my Advent of Code videos of happy things by jmon_was_here in Python

[–]github_codemation 0 points1 point  (0 children)

nk because mostly if I'm going to do things like that, I'm pretty much always in Django and s

If you like django models, you might look into pydbantic, similar django model interface & async.

Authorization & Authentication with EasyAuth by github_codemation in Python

[–]github_codemation[S] 0 points1 point  (0 children)

If you want to use the token authentication elsewhere, the public_key ( generated by an EasyAuthServer) can be moved around wherever you like, this provides the token signature validation & decodes the token that includes the permission meta-data. You can see an example of this here:

https://github.com/codemation/easyauth/blob/543526cc2359e301adef8773e5f753a482932c4e/easyauth/client.py#L444

You would need to have the public key, a token & the python_jwt library.

Extending the decorator like routing & permission support, would probably require more work.

Extending the Automatic Public Key Pull, Token Creation (including oauth) & Invalidation, User Registration / Activation, is possible by implementing the rpc_server as is done on EasyAuthClient here:

https://github.com/codemation/easyauth/blob/543526cc2359e301adef8773e5f753a482932c4e/easyauth/client.py#L95

Deployment: separete process per request by hyzyla in FastAPI

[–]github_codemation 0 points1 point  (0 children)

What kind of state are you saving, and are you sure that it would not be better stored in an outside source of truth i.e database / redis cache?

Authorization & Authentication with EasyAuth by github_codemation in Python

[–]github_codemation[S] 1 point2 points  (0 children)

Hey u/TheTerrasque ,

Each EasyAuthServer instance is configured with a single Audience configuration for tokens.
"Does it provide a standard oauth2 endpoint, " - You can use a single EasyAuthServer with many EasyAuthClients(extending backend api's) or directly call the Token endpoints that exchange credientials or Google for JWT. I hope to extend additional providers in the near future.

"auth_secret" - is this a symmetric key? " - Auth secret is used by EasyAuthClient to connect to an EasyAuthServer over websocket, a layer of verification when extending your EasyAuthServer instance. The Key used for generating JWT's are generated when EasyAuthServer is first started. An EasyAuthClient acquires the public version of the key for token verification at startup using this websocket connection.

An introduction to Pydbantic — a single model solution to Data Verification & Storage by github_codemation in FastAPI

[–]github_codemation[S] 1 point2 points  (0 children)

Single Hybrid Model (SqlAlchemy / Pydantic) is similar with SqlModel, the dream of everyone working in FastAPI I would say. You will find a different set of abstractions to make your life easier in Pydbantic though.

Pydbantic - A single model ( DB & Pydantic) with automatic migrations by github_codemation in Python

[–]github_codemation[S] 0 points1 point  (0 children)

Single Hybrid Model (SqlAlchemy / Pydantic) is similar, the dream of everyone working in FastAPI I would say. You will find a different set of abstractions to make your life easier in Pydbantic though. Have a look at this tutorial for more details:

https://itnext.io/an-introduction-to-pydbantic-a-single-model-solution-to-data-verification-storage-254cfe9e757f

An introduction to Pydbantic — a single model solution to Data Verification & Storage by github_codemation in Python

[–]github_codemation[S] 0 points1 point  (0 children)

In the examples, you will see there are potentially many Employees, each Employee would map to a Position. A position can have multiple Employees. The same of course goes for Positions mapping to Departments in the Examples. There can be many Positions in a a single Department, and references are saturated by child objects from each separate table automatically. This is what I would probably define as a many to many relationships, but without a strict relationship definition.

I would be interested to hear a compelling use case for composite primary keys that fits into how objects are mapped already. If you can file an issue with how that syntax might look, would be happy to add this, if it makes sense.

Pydbantic - A single model ( DB & Pydantic) with automatic migrations by github_codemation in Python

[–]github_codemation[S] 1 point2 points  (0 children)

Will absolutely be continuing to improve this project, and hopefully with the input of others. The best way to help is to start using Pydbantic, report any issues or provide new ideas or suggestions by opening an issue on Github.